#include "yolotest.h"
#include <iostream>
#include <string>

int main(int argc, char **argv){
    std::string model_path = "/home/vboxuser/yolo_test_cpp/best.onnx";
    std::string image_path = "/home/vboxuser/yolo_test_cpp/output.png";
    cv::Mat image = cv::imread(image_path);
    yolo_detector detector;
    if(detector.initialize(model_path)){
        auto results = detector.detect(image);
        detector.drawresluts(image, results);
    }
    // 创建窗口并显示结果
    cv::namedWindow("检测结果", cv::WINDOW_NORMAL);
    cv::imshow("检测结果", image);
    
    // 保存结果图像
    std::string outputPath = "result.jpg";
    cv::imwrite(outputPath, image);
    std::cout << "结果已保存至: " << outputPath << std::endl;

    // 等待用户按键
    cv::waitKey(0);
    return 0;
}